<?php

/*
 * Created on 06/07/2007
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
class HtmlLink {

	var $url;
	var $linkText;
	var $nColumn;
	var $qryString;
	var $onClick;

	function htmlLink($url, $linkText, $nColumn, $qryString, $onClick ="") {
		$this->url = $url;
		$this->linkText = $linkText;
		$this->nColumn = $nColumn;
		$this->qryString = $qryString;
		$this->onClick = $onClick;
	}

	function Render($row) {
	/*place the * to replace it by the id value, this should be temporal*/
		if($this->onClick != "")
			return "<a onClick=\"".str_replace("*",$row[$this->nColumn],$this->onClick)."\" href=\"" . $this->url . "\">$this->linkText</a>";
		else
			return "<a href=\"" . $this->url . $this->qryString . $row[$this->nColumn] . "\">$this->linkText</a>";			
	}

}

#$row[0] = 1;
#$l = new htmlLink("#","linkText",0,"?id=","newWindow('http://localhost/','windowTittle')");
#$l = new htmlLink("#","linkText",0,"?id=","newWindow('http://localhost/','windowTittle')");
#print_r($l);
#echo $l->Render($row);

?>
